<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
    </style>
</head>
<body>
    <div id="app">
        <book></book>
        <hr/>
        <asyncbook></asyncbook>
    </div>
</body>
</html>
<script src="./js/vue.js"></script>
<script>
    // 同步组件
    let book = {
        template:`<div>书籍组件（同步组件）</div>`,
        created(){
            console.log("book组件");
        }
    }

    // 异步组件：

    let asyncbook =function(resolve,reject){
        setTimeout(function(){
            resolve({
                template:`<div>书籍组件（异步组件）</div>`,
                created(){
                    console.log("asyncbook组件");
                }
            })
        },2000);
    }

   let vm = new Vue({
    el:"#app",
    components:{
        book,asyncbook
    }
   });



</script>